blob: 8acb5d90333e7018edd88c07c88ae29386e13813 [file] [log] [blame]
Daniel Stenberg43563562004-08-12 11:02:01 +00001Updated: August 12, 2004 (http://curl.haxx.se/docs/faq.html)
Daniel Stenbergeea22872004-03-16 07:56:51 +00002 _ _ ____ _
3 ___| | | | _ \| |
4 / __| | | | |_) | |
5 | (__| |_| | _ <| |___
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +00006 \___|\___/|_| \_\_____|
7
8FAQ
9
Daniel Stenbergc3318b42000-08-17 14:06:42 +000010 1. Philosophy
11 1.1 What is cURL?
12 1.2 What is libcurl?
13 1.3 What is cURL not?
14 1.4 When will you make curl do XXXX ?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +000015 1.5 Who makes cURL?
16 1.6 What do you get for making cURL?
Daniel Stenbergc528dc52001-08-07 11:17:37 +000017 1.7 What about CURL from curl.com?
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +000018 1.8 I have a problem who do I mail?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000019
Daniel Stenbergc3318b42000-08-17 14:06:42 +000020 2. Install Related Problems
21 2.1 configure doesn't find OpenSSL even when it is installed
Daniel Stenberg811edcd2004-08-10 08:41:41 +000022 2.1.1 native linker doesn't find OpenSSL
23 2.1.2 only the libssl lib is missing
Daniel Stenbergc3318b42000-08-17 14:06:42 +000024 2.2 Does curl work/build with other SSL libraries?
25 2.3 Where can I find a copy of LIBEAY32.DLL?
26 2.4 Does cURL support Socks (RFC 1928) ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000027
Daniel Stenbergc3318b42000-08-17 14:06:42 +000028 3. Usage Problems
29 3.1 curl: (1) SSL is disabled, https: not supported
30 3.2 How do I tell curl to resume a transfer?
31 3.3 Why doesn't my posting using -F work?
32 3.4 How do I tell curl to run custom FTP commands?
33 3.5 How can I disable the Pragma: nocache header?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +000034 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000035 3.7 Can I use curl to delete/rename a file through FTP?
36 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberg98871d12002-05-22 22:14:03 +000037 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg147a6732001-03-08 09:25:09 +000038 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenberg88d14e92001-05-29 14:02:20 +000039 3.11 How do I POST with a different Content-Type?
Daniel Stenberg6513dce2001-11-27 13:34:59 +000040 3.12 Why do FTP specific features over HTTP proxy fail?
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +000041 3.13 Why does my single/double quotes fail?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +000042 3.14 Does curl support javascript or pac (automated proxy config)?
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +000043 3.15 Can I do recursive fetches with curl?
Daniel Stenbergedd16d92004-08-12 11:39:00 +000044 3.16 What certificates do I need when I use SSL?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000045
Daniel Stenbergc3318b42000-08-17 14:06:42 +000046 4. Running Problems
47 4.1 Problems connecting to SSL servers.
Daniel Stenberge26ee092001-01-15 10:26:37 +000048 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000049 4.3 How can I use {, }, [ or ] to specify multiple URLs?
50 4.4 Why do I get downloaded data even though the web page doesn't exist?
51 4.5 Why do I get return code XXX from a HTTP server?
52 4.5.1 "400 Bad Request"
53 4.5.2 "401 Unauthorized"
54 4.5.3 "403 Forbidden"
55 4.5.4 "404 Not Found"
56 4.5.5 "405 Method Not Allowed"
Daniel Stenbergd60029d2001-12-19 23:25:04 +000057 4.5.6 "301 Moved Permanently"
Daniel Stenbergc3318b42000-08-17 14:06:42 +000058 4.6 Can you tell me what error code 142 means?
Daniel Stenberg4c485992001-04-22 15:45:27 +000059 4.7 How do I keep user names and passwords secret in Curl command lines?
Daniel Stenberg09ba8562000-10-27 12:25:00 +000060 4.8 I found a bug!
Daniel Stenberg2c100372000-12-19 07:30:51 +000061 4.9 Curl can't authenticate to the server that requires NTLM?
Daniel Stenbergbc743752002-05-15 21:40:29 +000062 4.10 My HTTP request using HEAD, PUT or DELETE doesn't work!
Daniel Stenberg522b85a2002-11-12 20:00:02 +000063 4.11 Why does my HTTP range requests return the full document?
Daniel Stenberg16077112002-11-20 19:17:43 +000064 4.12 Why do I get "certificate verify failed" ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000065
Daniel Stenbergc3318b42000-08-17 14:06:42 +000066 5. libcurl Issues
Daniel Stenberg7d09e512001-01-11 12:52:07 +000067 5.1 Is libcurl thread-safe?
Daniel Stenberga40b55d2000-11-22 07:27:26 +000068 5.2 How can I receive all data into a large memory chunk?
Daniel Stenberg2c100372000-12-19 07:30:51 +000069 5.3 How do I fetch multiple files with libcurl?
Daniel Stenberg910fc852000-12-30 11:48:51 +000070 5.4 Does libcurl do Winsock initing on win32 systems?
Daniel Stenberg7e3cd822003-12-08 13:59:35 +000071 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg4c485992001-04-22 15:45:27 +000072 5.6 What about Keep-Alive or persistent connections?
Daniel Stenbergdd82d692002-10-08 07:16:17 +000073 5.7 Link errors when building libcurl on Windows!
Daniel Stenberg811edcd2004-08-10 08:41:41 +000074 5.8 libcurl.so.3: open failed: No such file or directory
Daniel Stenberg1d323362004-08-12 14:09:10 +000075 5.9 How does libcurl resolve host names?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000076
Daniel Stenbergc3318b42000-08-17 14:06:42 +000077 6. License Issues
78 6.1 I have a GPL program, can I use the libcurl library?
79 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +000080 6.3 I have a BSD licensed program, can I use the libcurl library?
81 6.4 I have a program that uses LGPL libraries, can I use libcurl?
82 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
83 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000084
85==============================================================================
86
871. Philosophy
88
89 1.1 What is cURL?
90
91 cURL (or simply just 'curl') is a command line tool for getting or sending
92 files using URL syntax. The name is a play on 'Client for URLs', originally
Daniel Stenberg09ba8562000-10-27 12:25:00 +000093 with URL spelled in uppercase to make it obvious it deals with URLs. The
Daniel Stenbergd16c7572002-08-08 11:54:11 +000094 fact it can also be pronounced 'see URL' also helped, it works as an
95 abbrivation for "Client URL Request Library" or why not the recursive
Daniel Stenbergeea22872004-03-16 07:56:51 +000096 version: "Curl URL Request Library".
Daniel Stenbergc3318b42000-08-17 14:06:42 +000097
Daniel Stenberg4c485992001-04-22 15:45:27 +000098 Curl supports a range of common Internet protocols, currently including
Daniel Stenbergd73d28a2001-08-23 11:12:07 +000099 HTTP, HTTPS, FTP, FTPS, GOPHER, LDAP, DICT, TELNET and FILE.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000100
Daniel Stenberg8e7b2612001-03-22 11:23:48 +0000101 We spell it cURL or just curl. We pronounce it with an initial k sound:
102 [kurl].
Daniel Stenberg887e7282001-01-03 09:13:07 +0000103
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000104 NOTE: there are numerous sub-projects and related projects that also use the
105 word curl in the project names in various combinations, but you should take
106 notice that this FAQ is directed at the command-line tool named curl (and
Daniel Stenbergeea22872004-03-16 07:56:51 +0000107 libcurl the library), and may therefore not be valid for other curl-related
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000108 projects.
109
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000110 1.2 What is libcurl?
111
Daniel Stenbergbc5954f2001-03-23 08:16:24 +0000112 libcurl is a reliable and portable library which provides you with an easy
Daniel Stenberg4c485992001-04-22 15:45:27 +0000113 interface to a range of common Internet protocols.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000114
Daniel Stenbergeea22872004-03-16 07:56:51 +0000115 You can use libcurl for free in your application, be it open source,
116 commercial or closed-source.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000117
118 1.3 What is cURL not?
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000119
Daniel Stenbergeea22872004-03-16 07:56:51 +0000120 Curl is *not* a wget clone. That is a common misconception. Never, during
121 curl's development, have we intended curl to replace wget or compete on its
122 market. Curl is targeted at single-shot file transfers.
123
124 Curl is not a web site mirroring program. If you want to use curl to mirror
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000125 something: fine, go ahead and write a script that wraps around curl to make
126 it reality (like curlmirror.pl does).
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000127
Daniel Stenberg4c485992001-04-22 15:45:27 +0000128 Curl is not an FTP site mirroring program. Sure, get and send FTP with curl
129 but if you want systematic and sequential behavior you should write a
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000130 script (or write a new program that interfaces libcurl) and do it.
131
132 Curl is not a PHP tool, even though it works perfectly well when used from
133 or with PHP.
134
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000135 Curl is not a single-OS program. Curl exists, compiles, builds and runs
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000136 under a wide range of operating systems, including all modern Unixes (and a
137 bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000138
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000139 1.4 When will you make curl do XXXX ?
140
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000141 We love suggestions of what to change in order to make curl and libcurl
142 better. We do however believe in a few rules when it comes to the future of
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000143 curl:
144
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000145 * Curl -- the command line tool -- is to remain a non-graphical command line
146 tool. If you want GUIs or fancy scripting capabilities, you should look
147 for another tool that uses libcurl.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000148
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000149 * We do not add things to curl that other small and available tools already
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000150 do very fine at the side. Curl's output is fine to pipe into another
151 program or redirect to another file for the next program to interpret.
152
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000153 * We focus on protocol related issues and improvements. If you wanna do more
Daniel Stenberg5f8e93d2000-10-25 07:41:58 +0000154 magic with the supported protocols than curl currently does, chances are
Daniel Stenberg7d24ce92001-11-01 09:12:35 +0000155 big we will agree. If you wanna add more protocols, we may very well
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000156 agree.
157
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000158 * If you want someone else to make all the work while you wait for us to
159 implement it for you, that is not a very friendly attitude. We spend a
160 considerable time already on maintaining and developing curl. In order to
161 get more out of us, you should consider trading in some of your time and
162 efforts in return.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000163
164 * If you write the code, chances are bigger that it will get into curl
165 faster.
166
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000167 1.5 Who makes cURL?
168
169 cURL and libcurl are not made by any single individual. Sure, Daniel
Daniel Stenbergd16c7572002-08-08 11:54:11 +0000170 Stenberg writes the major parts, but other persons' submissions are
171 important and crucial. Anyone can contribute and post their changes and
172 improvements and have them inserted in the main sources (of course on the
173 condition that developers agree on that the fixes are good).
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000174
Daniel Stenberg81f22462001-11-27 13:33:21 +0000175 The list of contributors in the docs/THANKS file is only a small part of all
176 the people that every day provide us with bug reports, suggestions, ideas
177 and source code.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000178
179 curl is developed by a community, with Daniel at the wheel.
180
181 1.6 What do you get for making cURL?
182
Daniel Stenbergd16c7572002-08-08 11:54:11 +0000183 Project cURL is entirely free and open. No person gets paid for developing
184 curl. We do this voluntarily on our spare time.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000185
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000186 We get some help from companies. Contactor Data hosts the curl web site,
Daniel Stenbergeea22872004-03-16 07:56:51 +0000187 Haxx owns the curl web site's domain and sourceforge.net hosts project
188 services we take advantage from, like the bug tracker.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000189
Daniel Stenbergd3706812001-11-27 13:37:29 +0000190 If you want to support our project with a donation or similar, one way of
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000191 doing that would be to buy "gift certificates" at useful online shopping
192 sites, such as amazon.com or thinkgeek.com. Another way would be to sponsor
Daniel Stenbergd16c7572002-08-08 11:54:11 +0000193 us through a banner-program or even better: by helping us coding,
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000194 documenting, testing etc. You're welcome to send us a buck using paypal, as
195 described here: http://curl.haxx.se/donation.html
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000196
197 1.7 What about CURL from curl.com?
198
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000199 During the summer 2001, curl.com was busy advertising their client-side
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000200 programming language for the web, named CURL.
201
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000202 We are in no way associated with curl.com or their CURL programming
Daniel Stenbergeea22872004-03-16 07:56:51 +0000203 language.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000204
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000205 Our project name curl has been in effective use since 1998. We were not the
Daniel Stenberg4045cd52001-08-07 21:21:24 +0000206 first computer related project to use the name "curl" and do not claim any
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000207 first-hand rights to the name.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000208
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000209 We recognize that we will be living in parallel with curl.com and wish them
210 every success.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000211
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000212 1.8 I have a problem who do I mail?
213
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000214 Please do not mail any single individual unless you really need to. Keep
215 curl-related questions on a suitable mailing list. All available mailing
216 lists are listed in the MANUAL document and online at
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000217 http://curl.haxx.se/mail/
218
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000219 Keeping curl-related questions and discussions on mailing lists allows
220 others to join in and help, to share their ideas, contribute their
221 suggestions and spread their wisdom. Keeping discussions on public mailing
222 lists also allows for others to learn from this (both current and future
223 users thanks to the web based archives of the mailing lists), thus saving us
224 from having to repeat ourselves even more. Thanks for respecting this.
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000225
226
Daniel Stenbergc3318b42000-08-17 14:06:42 +00002272. Install Related Problems
228
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000229 2.1 configure doesn't find OpenSSL even when it is installed
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000230
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000231 This may be because of several reasons.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000232
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000233 2.1.1 native linker doesn't find openssl
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000234
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000235 Affected platforms:
236 Solaris (native cc compiler)
237 HPUX (native cc compiler)
238 SGI IRIX (native cc compiler)
Daniel Stenberg13962ad2000-09-28 10:26:44 +0000239 SCO UNIX (native cc compiler)
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000240
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000241 When configuring curl, I specify --with-ssl. OpenSSL is installed in
242 /usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
243 CRYPTO_lock in -lcrypto
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000244
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000245 Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER
246 -lcrypto, so ld can't find the library. This is due to a bug in the GNU
247 autoconf tool.
248
249 Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of
250 ./configure places the -L/usr/local/ssl/lib early enough in the command
251 line to make things work
252
Daniel Stenbergbfb16902000-08-17 11:42:59 +0000253 Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000254
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000255 2.1.2 only the libssl lib is missing
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000256
257 If all include files and the libcrypto lib is present, with only the
258 libssl being missing according to configure, this is mostly likely because
259 a few functions are left out from the libssl.
260
261 If the function names missing include RSA or RSAREF you can be certain
Daniel Stenberg4c485992001-04-22 15:45:27 +0000262 that this is because libssl requires the RSA and RSAREF libs to build.
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000263
264 See the INSTALL file section that explains how to add those libs to
265 configure. Make sure that you remove the config.cache file before you
266 rerun configure with the new flags.
267
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000268 2.2 Does curl work/build with other SSL libraries?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000269
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000270 Curl has been written to use OpenSSL, although there should not be much
Daniel Stenberg26d1aac2001-02-16 13:41:09 +0000271 problems using a different library. If anyone does "port" curl to use a
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000272 different SSL library, we are of course very interested in getting the
273 patch!
Daniel Stenberge9640b62000-08-02 07:17:56 +0000274
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000275 2.3 Where can I find a copy of LIBEAY32.DLL?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000276
277 That is an OpenSSL binary built for Windows.
278
279 Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000280 on a windows machine to do https://. Check out the curl web site to find
Daniel Stenberg4c485992001-04-22 15:45:27 +0000281 accurate and up-to-date pointers to recent OpenSSL DLLs and other binary
Daniel Stenberge9640b62000-08-02 07:17:56 +0000282 packages.
283
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000284 2.4 Does cURL support Socks (RFC 1928) ?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000285
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000286 Yes, SOCKS5 is supported.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000287
288
Daniel Stenbergc3318b42000-08-17 14:06:42 +00002893. Usage problems
Daniel Stenberge9640b62000-08-02 07:17:56 +0000290
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000291 3.1 curl: (1) SSL is disabled, https: not supported
Daniel Stenberge9640b62000-08-02 07:17:56 +0000292
293 If you get this output when trying to get anything from a https:// server,
294 it means that the configure script couldn't find all libs and include files
295 it requires for SSL to work. If the configure script fails to find them,
296 curl is simply built without SSL support.
297
298 To get the https:// support into a curl that was previously built but that
299 reports that https:// is not supported, you should dig through the document
300 and logs and check out why the configure script doesn't find the SSL libs
301 and/or include files.
302
303 Also, check out the other paragraph in this FAQ labeled "configure doesn't
304 find OpenSSL even when it is installed".
305
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000306 3.2 How do I tell curl to resume a transfer?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000307
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000308 Curl supports resumed transfers both ways on both FTP and HTTP.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000309
Daniel Stenberg887e7282001-01-03 09:13:07 +0000310 Try the -C option.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000311
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000312 3.3 Why doesn't my posting using -F work?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000313
314 You can't simply use -F or -d at your choice. The web server that will
315 receive your post assumes one of the formats. If the form you're trying to
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000316 "fake" sets the type to 'multipart/form-data', then and only then you must
Daniel Stenberge9640b62000-08-02 07:17:56 +0000317 use the -F type. In all the most common cases, you should use -d which then
318 causes a posting with the type 'application/x-www-form-urlencoded'.
319
Daniel Stenberg4c485992001-04-22 15:45:27 +0000320 This is described in some detail in the MANUAL and TheArtOfHttpScripting
321 documents, and if you don't understand it the first time, read it again
322 before you post questions about this to the mailing list. Also, try reading
323 through the mailing list archives for old postings and questions regarding
324 this.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000325
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000326 3.4 How do I tell curl to run custom FTP commands?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000327
328 You can tell curl to perform optional commands both before and/or after a
329 file transfer. Study the -Q/--quote option.
330
331 Since curl is used for file transfers, you don't use curl to just perform
Daniel Stenberg4c485992001-04-22 15:45:27 +0000332 FTP commands without transferring anything. Therefore you must always specify
Daniel Stenberge9640b62000-08-02 07:17:56 +0000333 a URL to transfer to/from even when doing custom FTP commands.
334
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000335 3.5 How can I disable the Pragma: nocache header?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000336
337 You can change all internally generated headers by adding a replacement with
338 the -H/--header option. By adding a header with empty contents you safely
339 disable that one. Use -H "Pragma:" to disable that specific header.
340
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000341 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000342
343 To curl, all contents are alike. It doesn't matter how the page was
Daniel Stenberg4c485992001-04-22 15:45:27 +0000344 generated. It may be ASP, PHP, Perl, shell-script, SSI or plain
Daniel Stenberge9640b62000-08-02 07:17:56 +0000345 HTML-files. There's no difference to curl and it doesn't even know what kind
346 of language that generated the page.
347
Daniel Stenberg20807382002-05-21 14:00:55 +0000348 See also item 3.14 regarding javascript.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000349
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000350 3.7 Can I use curl to delete/rename a file through FTP?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000351
Daniel Stenberg4c485992001-04-22 15:45:27 +0000352 Yes. You specify custom FTP commands with -Q/--quote.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000353
354 One example would be to delete a file after you have downloaded it:
355
356 curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
357
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000358 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000359
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000360 Curl does not follow so-called redirects by default. The Location: header
361 that informs the client about this is only interpreted if you're using the
362 -L/--location option. As in:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000363
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000364 curl -L http://redirector.com
365
Daniel Stenberg98871d12002-05-22 22:14:03 +0000366 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg368e3522001-01-29 10:16:21 +0000367
Daniel Stenbergdfdf4912001-12-21 09:20:04 +0000368 There exist many language interfaces/bindings for curl that integrates it
369 better with various languages. If you are fluid in a script language, you
370 may very well opt to use such an interface instead of using the command line
371 tool.
Daniel Stenberg4c485992001-04-22 15:45:27 +0000372
Daniel Stenberg4c485992001-04-22 15:45:27 +0000373 Find out more about which languages that support curl directly, and how to
374 install and use them, in the libcurl section of the curl web site:
Daniel Stenberg17de7e02004-08-10 12:41:44 +0000375 http://curl.haxx.se/libcurl/
Daniel Stenberg368e3522001-01-29 10:16:21 +0000376
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000377 In February 2003, there are interfaces available for the following
378 languages: Basic, C, C++, Cocoa, Dylan, Euphoria, Java, Lua, Object-Pascal,
379 Pascal, Perl, PHP, PostgreSQL, Python, Rexx, Ruby, Scheme and Tcl. By the
380 time you read this, additional ones may have appeared!
Daniel Stenberg368e3522001-01-29 10:16:21 +0000381
Daniel Stenberg147a6732001-03-08 09:25:09 +0000382 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000383
384 Curl adheres to the HTTP spec, which basically means you can play with *any*
Daniel Stenberg4c485992001-04-22 15:45:27 +0000385 protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000386 XML-RPC are all such ones. You can use -X to set custom requests and -H to
387 set custom headers (or replace internally generated ones).
388
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000389 Using libcurl is of course just as fine and you'd just use the proper
390 library options to do the same.
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000391
Daniel Stenberg88d14e92001-05-29 14:02:20 +0000392 3.11 How do I POST with a different Content-Type?
393
394 You can always replace the internally generated headers with -H/--header.
395 To make a simple HTTP POST with text/xml as content-type, do something like:
396
397 curl -d "datatopost" -H "Content-Type: text/xml" [URL]
398
Daniel Stenberg50e9f8f2001-10-23 10:12:28 +0000399 3.12 Why do FTP specific features over HTTP proxy fail?
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000400
401 Because when you use a HTTP proxy, the protocol spoken on the network will
402 be HTTP, even if you specify a FTP URL. This effectively means that you
Daniel Stenberg98871d12002-05-22 22:14:03 +0000403 normally can't use FTP specific features such as FTP upload and FTP quote
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000404 etc.
405
406 There is one exception to this rule, and that is if you can "tunnel through"
Daniel Stenberg271f96f2001-11-20 08:03:01 +0000407 the given HTTP proxy. Proxy tunneling is enabled with a special option (-p)
Daniel Stenberg97a8c982001-12-21 08:10:34 +0000408 and is generally not available as proxy admins usually disable tunneling to
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000409 other ports than 443 (which is used for HTTPS access through proxies).
410
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000411 3.13 Why does my single/double quotes fail?
412
413 To specify a command line option that includes spaces, you might need to
414 put the entire option within quotes. Like in:
415
416 curl -d " with spaces " url.com
Daniel Stenbergeea22872004-03-16 07:56:51 +0000417
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000418 or perhaps
419
420 curl -d ' with spaces ' url.com
421
422 Exactly what kind of quotes and how to do this is entirely up to the shell
Daniel Stenberg98871d12002-05-22 22:14:03 +0000423 or command line interpreter that you are using. For most unix shells, you
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000424 can more or less pick either single (') or double (") quotes. For
425 Windows/DOS prompts I believe you're forced to use double (") quotes.
426
Daniel Stenberg98871d12002-05-22 22:14:03 +0000427 Please study the documentation for your particular environment. Examples in
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000428 the curl docs will use a mix of both these ones as shown above. You must
429 adjust them to work in your environment.
430
Daniel Stenberg61f62842002-03-11 08:39:00 +0000431 Remember that curl works and runs on more operating systems than most single
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000432 individuals have ever tried.
433
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000434 3.14 Does curl support javascript or pac (automated proxy config)?
435
436 Many web pages do magic stuff using embedded javascript. Curl and libcurl
437 have no built-in support for that, so it will be treated just like any other
438 contents.
439
440 .pac files are a netscape invention and are sometimes used by organizations
441 to allow them to differentiate which proxies to use. The .pac contents is
442 just a javascript program that gets invoked by the browser and that returns
443 the name of the proxy to connect to. Since curl doesn't support javascript,
444 it can't support .pac proxy configuration either.
445
446 Some work-arounds usually suggested to overcome this javascript dependency:
447
Daniel Stenberg17de7e02004-08-10 12:41:44 +0000448 - Depending on the javascript complexity, write up a script that
449 translates it to another language and execute that.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000450
Daniel Stenberg17de7e02004-08-10 12:41:44 +0000451 - Read the javascript code and rewrite the same logic in another language.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000452
Daniel Stenberg17de7e02004-08-10 12:41:44 +0000453 - Implement a javascript interpreter, people have successfully used the
454 Mozilla javascript engine in the past.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000455
Daniel Stenberg17de7e02004-08-10 12:41:44 +0000456 - Ask your admins to stop this, for a static proxy setup or similar.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000457
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000458 3.15 Can I do recursive fetches with curl?
459
460 No. curl itself has no code that performs recursive operations, such as
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000461 those performed by wget and similar tools.
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000462
463 There exist wrapper scripts with that functionality (for example the
464 curlmirror perl script), and you can write programs based on libcurl to do
465 it, but the command line tool curl itself cannot.
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000466
Daniel Stenbergedd16d92004-08-12 11:39:00 +0000467 3.16 What certificates do I need when I use SSL?
Daniel Stenberg43563562004-08-12 11:02:01 +0000468
469 There are three different kinds of "certificates" to keep track of when we
470 talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl.
471
472 - Client certificate. The server you communicate may require that you can
473 provide this in order to prove that you actually are who you claim to be.
474 If the server doesn't require this, you don't need a client certificate.
475
476 - Server certificate. The server you communicate with has a server
477 certificate. You can and should verify this certficate to make sure that
478 you are truly talking to the real server and not a server impersonating
479 it. The server certificate verifaction process is made by using a
480 Certificate Authority certificate ("CA cert") that was used to sign the
481 server certificate. Server certificate verification is enabled by default
482 in curl and libcurl and is often the reason for problems as explained in
483 FAQ entry 4.12 and the SSLCERTS document
484 (http://curl.haxx.se/docs/sslcerts.html). Server certificates that are
485 "self-signed" or otherwise signed by a CA that you do not have a CA cert
486 for, cannot be verified. If the verification during a connect fails, you
487 are refused access. You then need to explicitly disable the verification
488 to connect to the server.
489
490 - Certificate Authority certificate ("CA cert"). You often have several CA
491 certs in a CA cert bundle that can be used to verify a server certificate
492 that was signed by one of the authorities in the bundle. curl comes with a
493 default CA cert bundle. You can override the default.
494
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000495
Daniel Stenbergc3318b42000-08-17 14:06:42 +00004964. Running Problems
497
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000498 4.1 Problems connecting to SSL servers.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000499
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000500 It took a very long time before we could sort out why curl had problems to
501 connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The
502 error sometimes showed up similar to:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000503
504 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
505
506 It turned out to be because many older SSL servers don't deal with SSLv3
507 requests properly. To correct this problem, tell curl to select SSLv2 from
508 the command line (-2/--sslv2).
509
Daniel Stenbergeea22872004-03-16 07:56:51 +0000510 There have also been examples where the remote server didn't like the SSLv2
Daniel Stenberge9640b62000-08-02 07:17:56 +0000511 request and instead you had to force curl to use SSLv3 with -3/--sslv3.
512
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000513 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenberg29470102000-06-02 13:32:01 +0000514
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000515 In general unix shells, the & letter is treated special and when used, it
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000516 runs the specified command in the background. To safely send the & as a part
Daniel Stenberg4c485992001-04-22 15:45:27 +0000517 of a URL, you should quote the entire URL by using single (') or double (")
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000518 quotes around it.
Daniel Stenberg29470102000-06-02 13:32:01 +0000519
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000520 An example that would invoke a remote CGI that uses &-letters could be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000521
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000522 curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000523
Daniel Stenbergdaf55702002-08-29 07:05:31 +0000524 In Windows, the standard DOS shell treats the %-letter specially and you
525 need to use TWO %-letters for each single one you want to use in the URL.
Daniel Stenberge26ee092001-01-15 10:26:37 +0000526
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000527 Also note that if you want the literal %-letter to be part of the data you
Daniel Stenbergdaf55702002-08-29 07:05:31 +0000528 pass in a POST using -d/--data you must encode it as '%25' (which then also
529 needs the %-letter doubled on Windows machines).
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000530
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000531 4.3 How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberg29470102000-06-02 13:32:01 +0000532
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000533 Because those letters have a special meaning to the shell, and to be used in
534 a URL specified to curl you must quote them.
Daniel Stenberg29470102000-06-02 13:32:01 +0000535
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000536 An example that downloads two URLs (sequentially) would do:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000537
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000538 curl '{curl,www}.haxx.se'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000539
Daniel Stenberge26ee092001-01-15 10:26:37 +0000540 To be able to use those letters as actual parts of the URL (without using
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000541 them for the curl URL "globbing" system), use the -g/--globoff option:
Daniel Stenberge26ee092001-01-15 10:26:37 +0000542
543 curl -g 'www.site.com/weirdname[].html'
544
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000545 4.4 Why do I get downloaded data even though the web page doesn't exist?
Daniel Stenberg29470102000-06-02 13:32:01 +0000546
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000547 Curl asks remote servers for the page you specify. If the page doesn't exist
548 at the server, the HTTP protocol defines how the server should respond and
549 that means that headers and a "page" will be returned. That's simply how
550 HTTP works.
Daniel Stenberg29470102000-06-02 13:32:01 +0000551
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000552 By using the --fail option you can tell curl explicitly to not get any data
553 if the HTTP return code doesn't say success.
Daniel Stenberg8f037322000-06-06 14:09:01 +0000554
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000555 4.5 Why do I get return code XXX from a HTTP server?
Daniel Stenberg29470102000-06-02 13:32:01 +0000556
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000557 RFC2616 clearly explains the return codes. This is a short transcript. Go
558 read the RFC for exact details:
Daniel Stenberg29470102000-06-02 13:32:01 +0000559
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000560 4.5.1 "400 Bad Request"
Daniel Stenberg29470102000-06-02 13:32:01 +0000561
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000562 The request could not be understood by the server due to malformed
563 syntax. The client SHOULD NOT repeat the request without modifications.
564
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000565 4.5.2 "401 Unauthorized"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000566
567 The request requires user authentication.
568
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000569 4.5.3 "403 Forbidden"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000570
571 The server understood the request, but is refusing to fulfill it.
572 Authorization will not help and the request SHOULD NOT be repeated.
573
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000574 4.5.4 "404 Not Found"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000575
576 The server has not found anything matching the Request-URI. No indication
577 is given of whether the condition is temporary or permanent.
578
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000579 4.5.5 "405 Method Not Allowed"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000580
581 The method specified in the Request-Line is not allowed for the resource
582 identified by the Request-URI. The response MUST include an Allow header
583 containing a list of valid methods for the requested resource.
584
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000585 4.5.6 "301 Moved Permanently"
Daniel Stenbergeea22872004-03-16 07:56:51 +0000586
Daniel Stenberg98871d12002-05-22 22:14:03 +0000587 If you get this return code and an HTML output similar to this:
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000588
589 <H1>Moved Permanently</H1> The document has moved <A
590 HREF="http://same_url_now_with_a_trailing_slash/">here</A>.
591
592 it might be because you request a directory URL but without the trailing
593 slash. Try the same operation again _with_ the trailing URL, or use the
594 -L/--location option to follow the redirection.
595
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000596 4.6 Can you tell me what error code 142 means?
Daniel Stenberg29470102000-06-02 13:32:01 +0000597
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000598 All error codes that are larger than the highest documented error code means
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000599 that curl has exited due to a crash. This is a serious error, and we
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000600 appreciate a detailed bug report from you that describes how we could go
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000601 ahead and repeat this!
Daniel Stenberg29470102000-06-02 13:32:01 +0000602
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000603 4.7 How do I keep user names and passwords secret in Curl command lines?
Daniel Stenberg29470102000-06-02 13:32:01 +0000604
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000605 This problem has two sides:
Daniel Stenberg29470102000-06-02 13:32:01 +0000606
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000607 The first part is to avoid having clear-text passwords in the command line
608 so that they don't appear in 'ps' outputs and similar. That is easily
Daniel Stenbergeea22872004-03-16 07:56:51 +0000609 avoided by using the "-K" option to tell curl to read parameters from a file
610 or stdin to which you can pass the secret info. curl itself will also
611 attempt to "hide" the given password by blanking out the option - this
612 doesn't work on all platforms.
Daniel Stenberg29470102000-06-02 13:32:01 +0000613
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000614 To keep the passwords in your account secret from the rest of the world is
615 not a task that curl addresses. You could of course encrypt them somehow to
616 at least hide them from being read by human eyes, but that is not what
617 anyone would call security.
Daniel Stenberg29470102000-06-02 13:32:01 +0000618
Daniel Stenbergeea22872004-03-16 07:56:51 +0000619 Also note that regular HTTP (using Basic authentication) and FTP passwords
620 are sent in clear across the network. All it takes for anyone to fetch them
621 is to listen on the network. Eavesdropping is very easy. Use more secure
622 authentication methods (like Digest, Negotiate or even NTLM) or consider the
623 SSL-based alternatives HTTPS and FTPS.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000624
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000625 4.8 I found a bug!
626
Daniel Stenberg4c485992001-04-22 15:45:27 +0000627 It is not a bug if the behavior is documented. Read the docs first.
Daniel Stenbergeea22872004-03-16 07:56:51 +0000628 Especially check out the KNOWN_BUGS file, it may be a documented bug!
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000629
630 If it is a problem with a binary you've downloaded or a package for your
631 particular platform, try contacting the person who built the package/archive
632 you have.
633
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000634 If there is a bug, read the BUGS document first. Then report it as described
635 in there.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000636
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000637 4.9 Curl can't authenticate to the server that requires NTLM?
Daniel Stenberg2c100372000-12-19 07:30:51 +0000638
Daniel Stenberg3a552b12003-06-26 11:35:48 +0000639 This is supported in curl 7.10.6 or later. No earlier curl version knows
640 of this magic.
641
642 NTLM is a Microsoft proprietary protocol. Proprietary formats are evil. You
643 should not use such ones.
Daniel Stenberg29470102000-06-02 13:32:01 +0000644
Daniel Stenbergbc743752002-05-15 21:40:29 +0000645 4.10 My HTTP request using HEAD, PUT or DELETE doesn't work!
646
647 Many web servers allow or demand that the administrator configures the
648 server properly for these requests to work on the web server.
649
650 Some servers seem to support HEAD only on certain kinds of URLs.
651
652 To fully grasp this, try the documentation for the particular server
653 software you're trying to interact with. This is not anything curl can do
654 anything about.
655
Daniel Stenberg522b85a2002-11-12 20:00:02 +0000656 4.11 Why does my HTTP range requests return the full document?
657
658 Because the range may not be supported by the server, or the server may
659 choose to ignore it and return the full document anyway.
Daniel Stenbergbc743752002-05-15 21:40:29 +0000660
Daniel Stenberg16077112002-11-20 19:17:43 +0000661 4.12 Why do I get "certificate verify failed" ?
662
663 You invoke curl 7.10 or later to communicate on a https:// URL and get an
664 error back looking something similar to this:
665
Daniel Stenbergeea22872004-03-16 07:56:51 +0000666 curl: (35) SSL: error:14090086:SSL routines:
Daniel Stenberg16077112002-11-20 19:17:43 +0000667 SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
668
669 Then it means that curl couldn't verify that the server's certificate was
670 good. Curl verifies the certificate using the CA cert bundle that comes with
671 the curl installation.
672
673 To disable the verification (which makes it act like curl did before 7.10),
674 use -k. This does however enable man-in-the-middle attacks.
675
676 If you get this failure but are having a CA cert bundle installed and used,
677 the server's certificate is not signed by one of the CA's in the bundle. It
678 might for example be self-signed. You then correct this problem by obtaining
679 a valid CA cert for the server. Or again, decrease the security by disabling
680 this check.
681
682 Details are also in the SSLCERTS file in the release archives, found online
Daniel Stenberg9b6d0102003-02-25 08:36:29 +0000683 here: http://curl.haxx.se/docs/sslcerts.html
Daniel Stenberg16077112002-11-20 19:17:43 +0000684
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000685
Daniel Stenbergc3318b42000-08-17 14:06:42 +00006865. libcurl Issues
Daniel Stenberg29470102000-06-02 13:32:01 +0000687
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000688 5.1 Is libcurl thread-safe?
Daniel Stenberg29470102000-06-02 13:32:01 +0000689
Daniel Stenberg7d09e512001-01-11 12:52:07 +0000690 Yes.
691
692 We have written the libcurl code specificly adjusted for multi-threaded
693 programs. libcurl will use thread-safe functions instead of non-safe ones if
694 your system has such.
Daniel Stenberg29470102000-06-02 13:32:01 +0000695
Daniel Stenberg4c485992001-04-22 15:45:27 +0000696 We would appreciate some kind of report or README file from those who have
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000697 used libcurl in a threaded environment.
Daniel Stenberg29470102000-06-02 13:32:01 +0000698
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000699 5.2 How can I receive all data into a large memory chunk?
700
Daniel Stenberga84af982001-05-15 13:09:27 +0000701 [ See also the examples/getinmemory.c source ]
702
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000703 You are in full control of the callback function that gets called every time
704 there is data received from the remote server. You can make that callback do
Daniel Stenberg4c485992001-04-22 15:45:27 +0000705 whatever you want. You do not have to write the received data to a file.
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000706
707 One solution to this problem could be to have a pointer to a struct that you
708 pass to the callback function. You set the pointer using the
709 curl_easy_setopt(CURLOPT_FILE) function. Then that pointer will be passed to
710 the callback instead of a FILE * to a file:
711
712 /* imaginary struct */
713 struct MemoryStruct {
714 char *memory;
715 size_t size;
716 };
717
718 /* imaginary callback function */
719 size_t
720 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
721 {
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000722 size_t realsize = size * nmemb;
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000723 struct MemoryStruct *mem = (struct MemoryStruct *)data;
Daniel Stenbergeea22872004-03-16 07:56:51 +0000724
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000725 mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
726 if (mem->memory) {
727 memcpy(&(mem->memory[mem->size]), ptr, realsize);
728 mem->size += realsize;
729 mem->memory[mem->size] = 0;
730 }
731 return realsize;
732 }
733
Daniel Stenberg2c100372000-12-19 07:30:51 +0000734 5.3 How do I fetch multiple files with libcurl?
Daniel Stenbergec5ac822000-12-14 08:37:09 +0000735
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000736 libcurl has excellent support for transferring multiple files. You should
737 just repeatedly set new URLs with curl_easy_setopt() and then transfer it
738 with curl_easy_perform(). The handle you get from curl_easy_init() is not
739 only reusable, but you're even encouraged to reuse it if you can, as that
740 will enable libcurl to use persistent connections.
Daniel Stenberga40b55d2000-11-22 07:27:26 +0000741
Daniel Stenbergbc5954f2001-03-23 08:16:24 +0000742 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg910fc852000-12-30 11:48:51 +0000743
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000744 Yes, if told to in the curl_global_init() call.
Daniel Stenberg910fc852000-12-30 11:48:51 +0000745
Daniel Stenberg7e3cd822003-12-08 13:59:35 +0000746 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg41084e52001-01-22 08:42:00 +0000747
748 Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
Daniel Stenberg7e3cd822003-12-08 13:59:35 +0000749 that DLL use the FILE * (as the DLL and the client application cannot access
750 each others' variable memory areas). If you set CURLOPT_WRITEDATA you must
751 also use CURLOPT_WRITEFUNCTION as well to set a function that writes the
752 file, even if that simply writes the data to the specified FILE *.
753 Similarly, if you use CURLOPT_READDATA you must also specify
754 CURLOPT_READFUNCTION.
Daniel Stenberg41084e52001-01-22 08:42:00 +0000755
Daniel Stenberg5d7b32d2001-02-04 20:08:42 +0000756 (Provided by Joel DeYoung and Bob Schader)
Daniel Stenberg41084e52001-01-22 08:42:00 +0000757
Daniel Stenberg4c485992001-04-22 15:45:27 +0000758 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +0000759
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000760 curl and libcurl have excellent support for persistent connections when
761 transferring several files from the same server. Curl will attempt to reuse
762 connections for all URLs specified on the same command line/config file, and
763 libcurl will reuse connections for all transfers that are made using the
764 same libcurl handle.
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +0000765
Daniel Stenbergdd82d692002-10-08 07:16:17 +0000766 5.7 Link errors when building libcurl on Windows!
767
768 You need to make sure that your project, and all the libraries (both static
769 and dynamic) that it links against, are compiled/linked against the same run
770 time library.
771
772 This is determined by the /MD, /ML, /MT (and their corresponding /M?d)
773 options to the command line compiler. /MD (linking against MSVCRT dll) seems
774 to be the most commonly used option.
775
776 (Provided by Andrew Francis)
777
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000778 5.8 libcurl.so.3: open failed: No such file or directory
779
780 This is an error message you might get when you try to run a program linked
781 with a shared version of libcurl and your run-time linker (ld.so) couldn't
782 find the shared library named libcurl.so.3.
783
784 You need to make sure that ld.so finds libcurl.so.3. You can do that
785 multiple ways, and it differs somewhat between different operating systems,
786 but they are usually:
787
788 * Add an option to the linker command line that specify the hard-coded path
789 the run-time linker should check for the lib (usually -R)
790
791 * Set an environment variable (LD_LIBRARY_PATH for example) where ld.so
792 should check for libs
793
794 * Adjust the system's config to check for libs in the directory where you've
795 put the dir (like Linux's /etc/ld.so.conf)
796
797 'man ld.so' and 'man ld' will tell you more details
798
Daniel Stenberg1d323362004-08-12 14:09:10 +0000799 5.9 How does libcurl resolve host names?
800
801 libcurl includes a number of different name resolve functions:
802
803 - The non-ipv6 resolver that can use one out of four host name resolve calls
804 (depending on what your system supports):
805
806 A - gethostbyname()
807 B - gethostbyname_r() with 3 arguments
808 C - gethostbyname_r() with 5 arguments
809 D - gethostbyname_r() with 6 arguments
810
811 - The ipv6-resolver that uses getaddrinfo()
812
813 - The c-ares based name resolver that uses the c-ares library for resolves.
814
815 - The Windows threaded resolver. It use:
816
817 A - gethostbyname() on plain ipv4 windows hosts
818 B - getaddrinfo() on ipv6-enabled windows hosts
Daniel Stenbergdd82d692002-10-08 07:16:17 +0000819
Daniel Stenbergc3318b42000-08-17 14:06:42 +00008206. License Issues
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000821
Daniel Stenberg1c961282002-09-03 11:58:18 +0000822 Curl and libcurl are released under a MIT/X derivate license. The license is
823 very liberal and should not impose a problem for your project. This section
824 is just a brief summary for the cases we get the most questions. (Parts of
825 this section was much enhanced by Bjorn Reese.)
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000826
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000827 6.1 I have a GPL program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000828
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000829 Yes!
Daniel Stenberg7d1ef962000-08-14 06:31:59 +0000830
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000831 Since libcurl may be distributed under the MIT/X derivate license, it can be
832 used together with GPL in any software.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000833
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000834 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000835
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000836 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000837
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000838 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000839
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000840 6.3 I have a BSD licensed program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000841
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000842 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000843
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000844 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000845
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000846 6.4 I have a program that uses LGPL libraries, can I use libcurl?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000847
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000848 Yes!
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000849
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000850 The LGPL license doesn't clash with other licenses.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000851
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000852 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000853
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000854 Yes!
Daniel Stenberg0d181b52001-01-04 12:43:53 +0000855
856 The MIT/X derivate license practically allows you to do almost anything with
857 the sources, on the condition that the copyright texts in the sources are
858 left intact.
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000859
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000860 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000861
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000862 No.
863
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000864 We have carefully picked this license after years of development and
865 discussions and a large amount of people have contributed with source code
866 knowing that this is the license we use. This license puts the restrictions
867 we want on curl/libcurl and it does not spread to other programs or
Daniel Stenberg3a552b12003-06-26 11:35:48 +0000868 libraries that use it. It should be possible for everyone to use libcurl or
869 curl in their projects, no matter what license they already have in use.